//=============================================================================
// PlasmaGun.
//=============================================================================
class TFSMiniCannon extends TFLinkGun
	placeable;

var() int GoopStartAmmo;

/* BestMode()
choose between regular or alt-fire
*/
function byte BestMode()
{
	local vector EnemyDir;
	local float EnemyDist;
	local bot B;

	B = Bot(Instigator.Controller);
	if ( (B == None) || (B.Enemy == None) )
		return 0;

	EnemyDir = B.Enemy.Location - Instigator.Location;
	EnemyDist = VSize(EnemyDir);
	if ( EnemyDist > 1000 && Frand() > 0.5)
		return 1;

	if (Frand() > 0.7)
		return 1;

	return 0;
}

function float GetAIRating()
{
	local Bot B;

	B = Bot(Instigator.Controller);
	if ( B == None )
		return AIRating;

	return AIRating * FMin(Pawn(Owner).DamageScaling, 1.5);
}

//function ConsumeAmmo(int Mode, float load)
//{
//}

//function ReallyConsumeAmmo(int Mode, float load)
//{
//    if (Ammo[Mode] != None)
//        Ammo[Mode].UseAmmo(int(load));
//}


simulated function float ChargeBar()
{
	Local int A;
	A=Ammo[1].AmmoAmount;

    /*if( Role < ROLE_Authority && GetFireMode(1).HoldTime <= 0)
	return 0;
    else*/
	return ((PlasmaGunChargedFire(GetFireMode(1)).GoopStartAmmo - A)/PlasmaGunChargedFire(GetFireMode(1)).MaxGoopLoad);

	//return FMin(1,GetFireMode(0).HoldTime/PlasmaGunChargedFire(GetFireMode(0)).mHoldClampMax);
}


simulated function bool HasAmmo()
{
    return ( (Ammo[0].AmmoAmount >= 1) || GetFireMode(1).bIsFiring );
}

defaultproperties
{
     FireModeClass(0)=Class'Taskforces.PlasmaGunAltFire'
     FireModeClass(1)=Class'Taskforces.PlasmaGunChargedFire'
     SelectSound=Sound'WeaponSounds.LinkGun.SwitchToLinkGun'
     bShowChargingBar=True
     bMatchWeapons=False
     bUseOldWeaponMesh=True
     bNoAmmoInstances=False
     InventoryGroup=5
     GroupOffset=1
     PickupClass=Class'Taskforces.PlasmaGunPickup'
     PlayerViewOffset=(X=-2.000000,Y=-2.000000,Z=-3.000000)
     AttachmentClass=Class'Taskforces.PlasmaGunAttachment'
     IconMaterial=Texture'TFMedia.General.ArkonHUD'
     IconCoords=(X1=219,Y1=405,X2=291,Y2=445)
     ItemName="Siege Minicannon"
     Mesh=SkeletalMesh'Weapons.LinkGun_1st'
     Skins(0)=Combiner'TFMedia.PlasmaGun.PlasmaGunCombiner1'
     UV2Texture=Shader'XGameShaders.WeaponShaders.WeaponEnvShader'
     AmmoRegenAmount(0)=15
     SkillCost=800
     StationDmgModifier=4
}
